﻿using MediatR;
using S.EarTag.Domain.Model;
using S.EarTag.Infrastructure.Repository.Interface.IEarTagRepository;

namespace S.EarTag.API.Mediator.MediatorCommand.MarkCommand
{
    public class MarkByIdCommandHandler : IRequestHandler<MarkByIdCommand, MarkModel>
    {
        private readonly IMarkModelRepository _markModelRepository;
        public MarkByIdCommandHandler(IMarkModelRepository markModelRepository)
        {
            _markModelRepository = markModelRepository;
        }
        /// <summary>
        /// 根据Id查询单个戴标数据用于反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<MarkModel> Handle(MarkByIdCommand request, CancellationToken cancellationToken)
        {
            return await _markModelRepository.GetByIdAsync(request.MarkId);
        }
    }
}
